//
//  BaseViewController.h
//  IOSBase
//
//  Created by chenliang on 14-8-8.
//  Copyright (c) 2014年 chenliang. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "AFHTTPRequestOperationManager.h"
#import "ASIHTTPRequest.h"
#import "../../Common/CProtocols.h"


//是否登录没有
static int isLogin = NO;

@interface BaseViewController : UIViewController
{
    //屏幕宽度
   CGFloat WIDTH;
    //屏幕高度
   CGFloat HEIGHT;
}

@property (nonatomic,retain) id<updateSuperViewDelegate> delegateUpdate;               //调用回调，刷新上一层界面的数据

#pragma mark -设置NavigationBar背景图片
-(void)setNavigationBarImage:(NSString*)image;

#pragma mark -设置自定义返回按钮
-(void)setBackButton;

#pragma mark -显示右边/左边按钮
-(void)setNavRightButton:(NSString*)title selecter:(SEL)sel;
-(void)setNavLeftButton:(NSString*)title selecter:(SEL)sel;

#pragma mark -隐藏右边/左边按钮
-(void)hideNavRightButton;
-(void)hideNavLeftButton;

#pragma mark -设置标题
-(void)setTitle:(NSString*)title;
#pragma mark -在TabBar上进行界面跳转PUSH 传入Controller名
-(void)pushTab:(NSString*)controller;

#pragma mark -在TabBar上进行界面跳转PUSH 传入Controller
-(void)pushTabController:(UIViewController*)controller;

-(void)pushTab2:(NSString*)controller;
-(void)pushTab3:(NSString*)controller;
-(void)pop3;

-(void)pushTab4:(NSString*)controller;

#pragma mark -界面跳转PUSH 传入Controller名
-(void)push:(NSString*)controller;

#pragma mark -界面返回POP
-(void)pop;
-(void)popRoot;

#pragma mark -界面跳转，present方式
-(void)present:(NSString*)controller;

#pragma mark -界面返回，dismissController方式
-(void)dismissController;

#pragma mark -显示进度HUD
-(void)showProgressHUD;

#pragma mark -显示进度HUD，并设置显示消息
-(void)showProgressHUD:(NSString*)message;
-(void)showProgressHUD:(UIView *)view message:(NSString *)message;

#pragma mark -隐藏进度HUD
-(void)hideProgressHUD;
-(void)hideProgressHUDForView:(UIView *)view;
-(void)hideHUDForView:(UIView *)view;

#pragma mark -隐藏错误消息HUD
-(void)showErrorHUD:(NSString *)message;

#pragma mark -隐藏消息HUD
-(void)showMessageHUD:(NSString*)message;

#pragma mark -发送网络请求，采用ASIHttp的方式
-(void)sendASI:(NSString*)url params:(NSDictionary*)params success:(void(^)(NSDictionary *dic))success failure:(void(^)(NSError *error))failure;

#pragma mark -发送网络请求
-(void)send:(NSString*)url params:(NSDictionary*)params success:(void (^)(id responseObject))success
    failure:(void (^)(NSError *error))failure;

#pragma mark -发送网络请求，发送前显示HUD，结束后隐藏HUD
-(void)send:(NSString*)url params:(NSDictionary*)params success:(void (^)(id responseObject))success;

#pragma mark -发送网络请求，发送前显示HUD，结束后隐藏HUD hudMessage HUD显示的信息
-(void)send:(NSString*)url params:(NSDictionary*)params hudMessage:(NSString*)message success:(void (^)(id responseObject))success;

#pragma mark -调整控件的位置,-1表示不跳转相应的边
-(void)reFrameView:(UIView*)v x:(CGFloat)x y:(CGFloat)y width:(CGFloat)width height:(CGFloat)height;

#pragma mark -按钮圆角
-(void)cornerView:(UIView*)view;

#pragma mark -重新设置图片大小
-(UIImage*)resizeImage:(UIImage*)image;

#pragma mark -区别iOS7与iOS6
-(BOOL) isIOS7;

#pragma mark -区别iPhone5与iPhone4
-(BOOL) isiPhone5;

#pragma mark-改变TableView点击的颜色
-(void) adapterCellColor:(UITableViewCell*)cell;

#pragma mark-邮箱校验
-(BOOL) isValidateEmail:(NSString *)email;

#pragma mark-中文用户名校验
-(BOOL)isValidateChinese:(NSString *)name;

#pragma mark-手机号校验
-(BOOL) isValidateMobile:(NSString *)mobileNum;

#pragma mark-MD5加密
-(NSString *)createMD5:(NSString *)signString;

#pragma mark-身份证号有效性验证
-(BOOL)isValidateIDCardNumber:(NSString *)value;

@end
